package org.five;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by Administrator on 2016/3/14 0014.
 */
public class TestClock {
    public static void main(String[] args) {

        Log log = LogFactory.getLog(TestClock.class);

        TimerTask tt = new TimerTask() {
            @Override
            public void run() {
                for ( int i = 0; i < 5; ) {
                    System.out.println("起床啦~~~");
                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };

        Timer timer = new Timer();
        log.info("timer初始化完成");
        Calendar c = Calendar.getInstance();
        log.info("Calendar初始化完成");
        c.set(2016,2,14,11,47,50);
        log.error("时间设定完成");
        timer.schedule(tt, c.getTime());
        log.debug("搞定");
    }
}
